{% extends 'father.html' %}

{% block btn %}
    <a href="/emp/add/" class="btn btn-primary">新建员工</a>

    <form method="GET" action="/emp/list/" class="float-end d-flex align-items-center">
        <div class="input-group mb-3" style="width:250px">
            <input type="text" name='q_name' class="form-control w-25" placeholder="用户名" aria-label="Recipient's username"
                   aria-describedby="button-addon2">
            <button class="btn btn-outline-secondary" type="submit" id="button-addon2">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search"
                 viewBox="0 0 16 16">
                <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
            </svg>
            </button>
        </div>
    </form>

{% endblock %}

{% block main %}
    <table class="table">
        <thead>
        <tr>
            <th scope="col">员工工号</th>
            <th scope="col">姓名</th>
            <th scope="col">年龄</th>
            <th scope="col">性别</th>
            <th scope="col">工资</th>
            <th scope="col">入职日期</th>
            <th scope="col">所属部门</th>
            <th scope="col">操作</th>

        </tr>
        </thead>
        <tbody>
        {% for emp in queryset %}
            <tr>
                <td>{{ emp.id }}</td>
                <td>{{ emp.e_name }}</td>
                <td>{{ emp.age }}</td>
                <td>{{ emp.get_gender_display }}</td>
                <td>{{ emp.account }}</td>
                <td>{{ emp.create_time|date:'Y-m-d' }}</td>
                <td>{{ emp.depart.title }}</td>
                <td>
                    <a href="/emp/{{ emp.id }}/update/" class="btn btn-success">修改</a>
                    <a href="/emp/{{ emp.id }}/delete/" class="btn btn-danger">删除</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>

    <ul class="pagination">
        {{ page_string }}
    </ul>

{% endblock %}